package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.RemoteClassaiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * stuclient服务
 * 
 * @author z
 */
@Component
public class RemoteClassaiFallbackFactory implements FallbackFactory<RemoteClassaiService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteClassaiFallbackFactory.class);

    @Override
    public RemoteClassaiService create(Throwable throwable)
    {
        log.error("classai服务调用失败:{}", throwable.getMessage());
        return new RemoteClassaiService()
        {

            /**
             * 举手
             * @param studenId  学生ID
             * @param teacherId 老师ID
             * @return 结果
             */
            @Override
            public AjaxResult getStudentHand(String studenId, String teacherId,String source) {
                return AjaxResult.error("消息推送失败");
            }

            /**
             * 查询学校信息
             * @param schoolId  学校id
             * @return 结果
             */
            @Override
            public AjaxResult getSchoolInfo(String schoolId,String source) {
                return AjaxResult.error("查询失败");
            }

            /**
             * 课后作业提醒
             * @return 结果
             */
            @Override
            public AjaxResult addHomeWorkMeaage(String source) {
                return AjaxResult.error("操作失败");
            }

        };
    }
}
